// package: rewords-server-2024
// filename: menu
// author: diogoxiang@gmail.com
// time: 2024/11/8 11:22

package admin

import (
	"rewords-server-2024/internal/model/entity"
	"rewords-server-2024/internal/model/input/admin_in"
	"rewords-server-2024/internal/model/input/query_in"

	"github.com/gogf/gf/v2/frame/g"
)

type MenuListReq struct {
	g.Meta         `path:"/sys/menu/query" method:"post" summary:"获取菜单列表" tags:"菜单"`
	Conditions     []query_in.Condition `json:"conditions,omitempty" summary:"查找条件"` // 查找字段
	*query_in.Page `json:"page"`
}
type MenuListRes struct {
	admin_in.MenuTreeModel
	//query_in.PageResult
}

type MenuAddReq struct {
	g.Meta `path:"/sys/menu/add" method:"post" summary:"添加菜单" tags:"菜单"`
	entity.SysMenu
}

type MenuAddRes struct {
	Id int64 `json:"id" summary:"菜单ID"`
}

type MenuDeleteReq struct {
	g.Meta `path:"/sys/menu/del" method:"post" summary:"删除菜单" tags:"菜单"`
	Ids    int64 `json:"ids" v:"required#菜单ID不能为空" dc:"菜单ID"`
}

type MenuDeleteRes struct{}

type MenuInfoReq struct {
	g.Meta `path:"/sys/menu/query_id" method:"get" summary:"获取菜单信息" tags:"菜单"`
	Id     int64 `json:"id" v:"required#菜单ID不能为空" dc:"菜单ID"`
}

type MenuInfoRes struct {
	entity.SysMenu
}

type MenuUpdateReq struct {
	g.Meta `path:"/sys/menu/update" method:"put" summary:"更新菜单" tags:"菜单"`
	entity.SysMenu
}
type MenuUpdateRes struct {
	Id int64 `json:"id" summary:"菜单ID"`
}

// BatchUpdateReq BatchUpdate 批量更新参数，rows 需包含 ID 字段
type MenuBatchUpdateReq struct {
	g.Meta `path:"/sys/menu/batch-update" method:"patch" summary:"批量更新菜单" tags:"菜单"`
	Rows   []map[string]any `json:"rows"`
}

type MenuBatchUpdateRes struct {
	Rows []int64 `json:"rows"`
}

type MenuSimpleReq struct {
	g.Meta `path:"/sys/menu/fetch" method:"get" summary:"获取菜单树" tags:"菜单"`
}
type MenuSimpleRes struct {
	Pages []*admin_in.MenuSimple `json:"pages" dc:"sidebar amis"`
}

type MenuKvReq struct {
	g.Meta  `path:"/sys/menu/options" method:"get" summary:"获取kv菜单树" tags:"菜单"`
	Visible bool  `json:"disable_value" d:"true" dc:"是否显示" `
	id      int64 `json:"id" dc:"当前id"`
}

type MenuKvRes struct {
	Options []*admin_in.MenuKv `json:"options" dc:"sidebar amis"`
}
